<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Minim : : FFT : : forward</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body> 
<center>
<table class="mainTable">

  <tr>
    <td class="header">
    	<span class="indexheader">Minim</span><br/>
    	<span class="indexnavigation">
    		<a href="index.html">core</a> | 
    		<a href="index_ugens.html">ugens</a> | 
    		<a href="index_analysis.html">analysis</a>
    	</span>
    </td>
    <td class="border-left">&nbsp;</td>
  </tr>
  
  <tr>
    <td class="classNavigation">
    	<p class="mainTextName"><A href="fouriertransform_class_fouriertransform.html">FourierTransform</A></p>
    	<p class="methodName">forward</p>
    </td>
    <td class="mainText border-left">
    	<p class="memberSectionHeader">Description</p>
    	Performs a forward transform on <code>buffer</code>.
    	
    	<p class="memberSectionHeader">Signature</p>
    	<pre>void forward(float[] buffer)
void forward(float[] buffer, int startAt)
void forward(AudioBuffer buffer)
void forward(AudioBuffer buffer, int startAt)
</pre>
    	
    	
   <p class="memberSectionHeader">Parameters</p>
   
        <span class="parameterName">buffer</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">float[]: the buffer to analyze, must be the same length as timeSize()</span><br/>
    
        <span class="parameterName">startAt</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">int: the index to start at in the buffer. there must be at least timeSize() samples
          between the starting index and the end of the buffer. If there aren't, an
          error will be issued and the operation will not be performed.</span><br/>
    
        <span class="parameterName">buffer</span>&nbsp;&mdash;&nbsp;<span class="parameterDescription">AudioBuffer: the buffer to analyze</span><br/>
    
   
    	
   <p class="memberSectionHeader">Returns</p> 
   <p>None</p>
   
    	
    	<p class="memberSectionHeader">Related</p>
    	<A href="fft_class_fft.html">FFT</A><BR>

    	
    	<p class="memberSectionHeader">Example</p>
    	<pre>/**
  * This sketch demonstrates how to use an FFT to analyze
  * the audio being generated by an AudioPlayer.
  * &lt;p>
  * FFT stands for Fast Fourier Transform, which is a 
  * method of analyzing audio that allows you to visualize 
  * the frequency content of a signal. You've seen 
  * visualizations like this before in music players 
  * and car stereos.
  * &lt;p>
  * For more information about Minim and additional features, 
  * visit http://code.compartmental.net/minim/
  */

import ddf.minim.analysis.*;
import ddf.minim.*;

Minim       minim;
AudioPlayer jingle;
FFT         fft;

void setup()
{
  size(512, 200, P3D);
  
  minim = new Minim(this);
  
  // specify that we want the audio buffers of the AudioPlayer
  // to be 1024 samples long because our FFT needs to have 
  // a power-of-two buffer size and this is a good size.
  jingle = minim.loadFile("jingle.mp3", 1024);
  
  // loop the file indefinitely
  jingle.loop();
  
  // create an FFT object that has a time-domain buffer 
  // the same size as jingle's sample buffer
  // note that this needs to be a power of two 
  // and that it means the size of the spectrum will be half as large.
  fft = new FFT( jingle.bufferSize(), jingle.sampleRate() );
  
}

void draw()
{
  background(0);
  stroke(255);
  
  // perform a forward FFT on the samples in jingle's mix buffer,
  // which contains the mix of both the left and right channels of the file
  fft.forward( jingle.mix );
  
  for(int i = 0; i &lt; fft.specSize(); i++)
  {
    // draw the line for frequency band i, scaling it up a bit so we can see it
    line( i, height, i, height - fft.getBand(i)*8 );
  }
}
</pre>
    	
    	<p class="memberSectionHeader">Usage</p>
    	Web & Application
    </td>
  </tr>
</table>
</center>
</body>
</html>
